Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
trying to redirect to an "a" tag for a file download in laravel 8

I'm trying redirect for a file download using btn.attr('href',generatedLink); using trigger('click') event but the event isn't firing. Here's my code:

 $('#downloadLossReport').on('click', function(e){
        var startDate = lossDate.toLocaleString();
        var endDate = lossDateTwo.toLocaleString();
        var type = $('.lossReportsType').filter('.selected').data('type');
        var status = $('.lossReportsStatus').filter('.selected').data('status');
        console.log("type: " + type);
        console.log("status: " + status);
        console.log("start date " + startDate);
        console.log("start date " + endDate);
        
        console.log("status: " + status);
        var btn = $('.downloadLossReport').children("a");
        var generatedLink = "lossReport/" + startDate + '/' + endDate + '/' + type + '/' + status;
        //e.stopPropagation();
        btn.attr('href', generatedLink);
        console.log(generatedLink);
        btn.trigger('click');
        //$('a')[0].click();
        console.log(btn);
    });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!